package cn.xorange.commons.security.exception;

import cn.xorange.commons.utils.configuration.constants.HttpStatus;
import lombok.Getter;

/**
 * @author : yangjian
 * @date : 2023/11/25
 */
@Getter
public enum SecurityErrorCode {

    SUCCESS(HttpStatus.SUCCESS,0,"请求成功"),
    ERROR(HttpStatus.ERROR,500,"系统错误"),
    PARAM_ERROR(HttpStatus.SUCCESS, 9001, "系统参数错误"),
    LOGIN_HANDLER_NOT_FOUND(HttpStatus.SUCCESS,3001,"登录处理器未找到"),
    TENANT_NOT_FOUND_EXCEPTION(HttpStatus.SUCCESS,3002,"渠道信息未找到"),
    TENANT_ON_ERROR(HttpStatus.SUCCESS,3003,"租户模式未开启"),
    AUTH_USERNAME_OR_PWD_ERROR(HttpStatus.SUCCESS,3301,"用户名密码错误"),
    AUTH_TOKEN_UNAUTHORIZED(HttpStatus.UNAUTHORIZED,3401,"token失效或已过期"), //token伪造等
    AUTH_TOKEN_FORBIDDEN(HttpStatus.FORBIDDEN, 3403, "当前操作没有权限"),
    SUPPER_USER_PHONE_IS_NULL(HttpStatus.SUCCESS,3801,"超级用户未设置手机号，无法登录"),
    INTERCEPT_RATE_LIMITER(HttpStatus.SUCCESS,4101,"访问过于频繁，请稍候再试");


    SecurityErrorCode(int status, int code, String msg){
        this.status = status;
        this.code = code;
        this.msg = msg;
    }

    private final int status;
    private final int code;
    private String msg;

    public void setMsg(String msg){
        this.msg = msg;
    }
}
